﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JibberJabber.PartDesigners;

namespace JibberJabber.LivePreviews
{
    internal class TextPreview : PreviewTemplate
    {
        TextPartDesigner tpd;

        internal TextPreview(TextPartDesigner tpd)
        {
            this.tpd = tpd;
            checkOk(tpd);
        }

        // Remember: configureTempConversation has Exceptions neatly handled,
        // the constructor does not!
        protected override void configureTempConversation(TempConversation tc)
        {
            SpeakerDesigner speaker = Program.FindSpeakerByName(tpd.cmbSpeaker.Text);
            if (speaker != null)
                tc.SetSpeaker(speaker);
            tc.SetContent(tpd);
        }
    }
}
